#include <fstream>
#include <cstdlib>
#include <iomanip>

using namespace std;

char FILENAME[20] = "HotelReview.txt";
int MIN_REVIEW = 1;
int MAX_REVIEW = 5;
int NO_OF_REVIEWS = 200;
//int NO_OF_HOTELS = 391;
int NO_OF_HOTELS = 15;
int NO_OF_MEMBERS = 50;
string COMMENT[5] = {"Excellent!", "Not bad", "You get what you pay for..", "Once is enough!", "I want to complain!"};
int main()
{
	fstream file(FILENAME, ios::out);
	
	srand(time(NULL));
	int h, m, l, v, c, s, comment;
	float a;
	bool revAry[NO_OF_MEMBERS][NO_OF_HOTELS] = {false};
	bool dup = false;
	
	for(int i = 1; i <= NO_OF_REVIEWS; i++)
	{
		do{
			srand(rand());		
			h = (rand() % NO_OF_HOTELS) + 1;
			srand(rand());
			m = (rand() % NO_OF_MEMBERS) + 1;
			dup = false;
			if(revAry[h-1][m-1])
				dup = true;
		}while(dup);
		srand(rand());
		l = (rand() % MAX_REVIEW) + MIN_REVIEW;
		srand(rand());		
		v = (rand() % MAX_REVIEW) + MIN_REVIEW;
		srand(rand());		
		c = (rand() % MAX_REVIEW) + MIN_REVIEW;	
		srand(rand());		
		s = (rand() % MAX_REVIEW) + MIN_REVIEW;
		a = (l + v + c + s) / 4.0;
		
	file << "HR" << setw(5) << setfill('0') << i << "~"
		 << "HI" << setw(5) << setfill('0') << h << "~"
		 << "ID" << setw(5) << setfill('0') << m << "~"
		 << l << "~"
		 << v << "~"
		 << c << "~"
		 << s << "~"
		 << setprecision(2) << a << "~";
	
	if(a >= 4.0)
		file << COMMENT[0] << "\n";
	else if(a >= 3.0)
		file << COMMENT[1] << "\n";
	else if(a >= 2.0)
		file << COMMENT[2] << "\n";
	else if(a >= 1.0)
		file << COMMENT[3] << "\n";
	else
		file << COMMENT[4] << "\n";
	}
}